package com.cn.config;

import com.cn.methodlock.aop.MethodLockEnableSessionId;
import com.cn.util.AuthUserContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * description: 分布式锁获取登录人信息 <br>
 * date: 23.7.20 15:13 <br>
 * author: cn_yaojin <br>
 * version: 1.0 <br>
 */
@Component
@Slf4j
public class MethodLockEnableSessionIdImpl implements MethodLockEnableSessionId {

    @Override
    public String getSessionId() {
        try {
            var user = AuthUserContext.get();
            return user.getId().toString();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
